package com.wk.springboot.springbootproject.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;

@Configuration
@Validated
public class Cat {

    @Value("${cat.first-name}")
    private String firstName;

    @Value("${cat.name}")
    @Email
    private String name;

    @Value("#{${cat.age}*2}")
    private Integer age;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "firstName='" + firstName + '\'' +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
